<!--#layout("/common/layout.html",{"jsBase":"/js/answer/answer/"}){ -->
<div class="layui-row">
    <form id="searchForm" class="layui-form layui-form-pane">

        <input type="hidden" name="questionId" value="${questionId}">

        <div class="layui-collapse" lay-filter="condictionCol">
            <div class="layui-colla-item">
                <h2 class="layui-colla-title">查询条件</h2>
                <div class="layui-colla-content layui-show">
                    <div class="layui-row">
                        <div class="layui-form-item">
                            <div class="layui-inline">

                                <label class="layui-form-label">问题名称</label>

                                <div class="layui-input-inline">
                                    <input type="text" name="questionTitle" autocomplete="off" class="layui-input">
                                </div>

                                <label class="layui-form-label">回答内容</label>

                                <div class="layui-input-inline">
                                    <input type="text" name="answerContent" placeholder="请输入" class="layui-input"></textarea>
                                </div>

                                <label class="layui-form-label">是否推荐</label>

                                <div class="layui-input-inline">
                                    <select name="isTop" lay-verify="">
                                        <option value="">不限制</option>
                                        <option value="1">是</option>
                                        <option value="0">否</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">省份</label>
                                <div class="layui-input-inline">
                                    <layui:simpleDataSelect name="provinceId"  data="${provinceList}"
                                                            attrId="provId" attrName="provName" laySearch="true" layFilter="colFilter" id="provinceId" />
                                </div>
                                <label class="layui-form-label" >回答者</label>
                                <div class="layui-input-inline">
                                    <select style="width:40%" class="select" name="customerId" id="customerId" selectValue="" promtion="请选择" lay-search>
                                        <option value="">请选择</option>
                                    </select>
                                </div>
                                <label class="layui-form-label">创建时间</label>
                                <div class="layui-input-inline">
                                    <div class="date-range-pick">
                                        <input type="text" name="createdTimeQuery" autocomplete="off" class="layui-input">
                                    </div>
                                </div>

                                <button style="float: right;" class="layui-btn layui-btn-normal" type="button" id="searchFormSearch">搜索</button>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>

<div class="layui-btn-group">
    <layui:accessButton function="answer.answer.edit" action="edit">编辑</layui:accessButton>
    <layui:accessButton function="answer.answer.del" action="del">删除</layui:accessButton>
    <layui:accessButton function="answer.qaAnswerComment.query" action="comment">该回答的评论</layui:accessButton>
</div>

<table id="answerTable" lay-filter="answerTable"></table>
<!--#} -->
<script>
    layui.use(['index','laydate','form'], function () {
        var index = layui.index,
            laydate = layui.laydate,
            form = layui.form;
        index.init();

        $('.time').each(function(){
            laydate.render({
                elem: this
                ,format: 'yyyy-MM-dd'
            });
        });

        form.on('select(colFilter)', function(data){
            setAuthor(data.value);
        });

        setAuthor();

        function setAuthor(id) {
            $.ajax({
                type: 'POST',
                url: "${ctxPath}/content/resContentMain/getAuthor.json",
                data: {
                    provinceId:id
                },
                dataType:'json',
                success: function(data){
                    $("#customerId").html("");
                    $("#customerId").append($("<option>").val("").text("请选择"));
                    $.each(data.data, function(key, val) {
                        var option1 = $("<option>").val(val.customerId).text(val.customerName);
                        $("#customerId").append(option1);
                    });
                    form.render('select');
                }
            });
        }
    });

</script>
